<template>
	<view :style="[{'font-weight':Style,'font-family':Font}]">
		<cu-custom bgColor="bg-gradual-blue" isBack="true">
			<view slot="backText">返回</view>
			<view slot="content">类型管理</view>
		</cu-custom>
		<sear-ch :placeholder="placeholder" @clean="clean" @input="input" @remove="remove"></sear-ch>
		<screen-view ref="screen" @formSubmit="formSubmit" :searchCondition="searchCondition"></screen-view>
		<!-- 下拉刷新组件 -->
		<mix-pulldown-refresh ref="mixPulldownRefresh" :top="CustomBar + 100 + 80" :scrolltopa="scrollTop" @refresh="onPulldownReresh"
		 @setEnableScroll="setEnableScroll" @loadMore='loadMore' @scroll='scroll'>
			<!-- 数据列表组件 -->
			<first-list :deliverplan="deliverplan" #default="{item}" :startisShow="false" >
				<view class="laoda_two" @tap="jump(item.lid)">
					<view class="flex padding-xs justify-between text-bold">
						<view>机器编号{{item.lcode}}</view>
					</view>
					<view class="flex padding-xs justify-between">
						<view>机器名称:{{item.lname}}</view>
						<view>是否有效:{{item.lisused == true ? '有效' : '无效'}}</view>
					</view>
					<view class="flex padding-xs justify-between">
						<view>备注:{{item.lremark}}</view>
					</view>
				</view>
			</first-list>
			<!-- 上滑加载更多组件 -->
			<mix-load-more :status="2" v-if="!isFlag"></mix-load-more>
		</mix-pulldown-refresh>
		<button-father :Position="'tb-fa-fixed'">
			<button class="cu-btn bg-gradual-blue lg shadow tb-flex cu-btn-new" @tap="jumpdetail">档案录入</button>
		</button-father>
		<back-top v-if="isShow" @topClick="topClick">
			<image class="topimg" mode="aspectFit" src="https://www.ahlinghui.com/Uploads/image/20190429/images/BackTop.png"></image>
		</back-top>
		<lime-tips v-if="isFlag" :fixed="true" imgUrl="/static/images/img_noorder@3x.png">咦！暂时没有数据呢……</lime-tips>
	</view>
</template>

<script>
	import SearCh from '@/colorui/components/search.nvue'
	import ScreenView from '@/colorui/components/ScreenView.vue'
	import mixPulldownRefresh from '@/colorui/components/mixpulldownrefresh.vue'
	import mixLoadMore from '@/colorui/components/mixloadmore';
	import FirstList from '@/colorui/components/FirstList.nvue'
	import BackTop from '@/colorui/components/BackTop.vue'
	import ButtonFather from '@/colorui/components/ButtonFather.vue'
	import {
		mapGetters
	} from 'vuex'
	import {
		postlogin
	} from '@/service/login.js'
	import {
		inputSearch,
		scrollrefresh
	} from "@/mixin/mixin.js"
	import {
		getSelectList,
		getselectForm1
	} from "@/service/selectList.js"
	export default {
		mixins: [inputSearch, scrollrefresh],
		data() {
			return {
				placeholder: '名称',
				searchView: 'lname',
				searchCondition: [{
					name: '名称',
					code: 'lname',
					checked: true
				} ],
				isShow: false,
				flag: true,
				isFlag: false,
				count: 0,
				CustomBar: this.CustomBar,
				deliverplan: []
			}
		},
		computed: {
			...mapGetters([
				'Style', 'Font',
			]),

		},
		onLoad() {
			this.getSelectList()
		},
		onShow() {
			if (this.count) {
				this.getSelectList()
			}
			this.count = 1
		},
		components: {
			SearCh,
			ScreenView,
			mixPulldownRefresh,
			mixLoadMore,
			FirstList,
			BackTop,
			ButtonFather
		},
		methods: {
			formSubmit(e) {
				console.log(e);
			},
			getSelectList() {
				getselectForm1(196).then(res => {
					if (res.code == 1) {
						res.data.forEach((val,index) => {
							val['isShow'] = true
						})
						this.deliverplan = res.data
					}
				})
			},
			// 跳转档案录入页面
			jumpdetail() {
				uni.navigateTo({
					url: './TypeAdminadd/TypeAdminadd'
				})
			},
			jump(lid) {
				uni.navigateTo({
					url:`./TypeAdminadd/TypeAdmindetail?lid=${lid}`
				})
			}
		},
		watch: {
			deliverplan() {
				this.deliverplan.length ? this.isFlag = false : this.isFlag = true
			}
		},
	}
</script>

<style>
	page {
		background-color: whitesmoke;
	}

	.topimg {
		width: 100rpx;
		height: 100rpx;
	}
</style>
